'use strict';
const path = require('path');
const fs = require('fs');
/**
 * 实体基类
 */
class BaseEntity {
  constructor() {
    this.isDebug = this._loadIsDebugSetting();
    this.entityName = 'BaseEntity';
  }
  _loadIsDebugSetting() {
    try {
      const baseConfigPath = path.resolve(process.cwd(), 'config/baseConfig.json');
      if (fs.existsSync(baseConfigPath)) {
        const configContent = fs.readFileSync(baseConfigPath, 'utf8');
        const config = JSON.parse(configContent);
        return config.isDebug === true;
      }
    } catch (error) {
      console.error('[Logger] 加载baseConfig.json失败，默认为开发环境:', error);
    }

    // 默认为true，保留原有行为
    return process.env.NODE_ENV !== 'production';
  }
}

module.exports = BaseEntity; 